07. 条件概率与贝叶斯规则测试
条件概率与贝叶斯规则测试
在前面部分中,你在癌症结果数据集中发现了以下比例。
- 患癌症病人: 0.105
- 没有患癌症病人: 0.895
- 检测结果为阳性的患癌病人: 0.905
- 检测结果为阴性的患癌病人: 0.095
- 没有患癌但检测结果为阳性的病人概率: 0.204
- 没有患癌且检测结果为阴性的病人概率: 0.796
根据观察数据中的上述比例,我们可以假定以下概率。
概率 | 含义 |
---|---|
P(cancer) = 0.105 | 患癌症病人的概率 |
P(~cancer) = 0.895 | 没有患癌症病人的概率 |
P(positive|cancer) = 0.905 | 检测结果为阳性的患癌病人概率 |
P(negative|cancer) = 0.095 | 检测结果为阴性的患癌病人概率 |
P(positive|~cancer) = 0.204 | 没有患癌但检测结果为阳性的病人概率 |
P(negative|~cancer) = 0.796 | 没有患癌且检测结果为阴性的病人概率 |
练习问题
利用上面的概率和贝叶斯规则,计算下面的概率。
- 检测结果为阳性的病人患癌概率,或 P(cancer|positive)
- 检测结果为阳性的病人没有患癌概率,或 P(~cancer|positive)
- 检测结果为阴性的病人患癌概率,或 P(cancer|negative)
- 检测结果为阴性的病人没有患癌概率,或 P(~cancer|negative)
然后,利用 Jupyter Notebook 对比这些结果和数据集的正确比例。
QUIZ QUESTION: :
利用上面的概率和贝叶斯规则,计算下面的概率。
ANSWER CHOICES:
概率 |
值 |
---|---|
0.236 |
|
0.014 |
|
0.389 |
|
0.986 |
|
0.342 |
|
0.674 |
|
0.658 |
SOLUTION:
概率 |
值 |
---|---|
0.014 |
|
0.986 |
|
0.342 |
|
0.658 |
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: jupyter
- Opened files (when workspace is loaded): n/a